#pragma once

#include <boost\signals.hpp>

template<typename SIGNAL_TYPE>
class CSignal
{
	friend class CSignalSlot;
public:
	explicit CSignal(SIGNAL_TYPE& signal) : m_refSignal(signal){}
	~CSignal(void){}

private:
	SIGNAL_TYPE& m_refSignal;
};

class CSignalSlot
{
public:
	CSignalSlot(){}
	~CSignalSlot(){
		_connection.disconnect();
	}

	template<typename SIGNAL_TYPE, typename SLOT_FUNC_TYPE>
	void Connect(SIGNAL_TYPE& _signal, const SLOT_FUNC_TYPE& _slotFunc){
		_connection = _signal.m_refSignal.connect(_slotFunc);
	}

	void Disconnect(){
		_connection.disconnect();
	}

private:
	boost::signals::connection _connection;
};